csscustomproperty: Move compute code to GtkCssTypedValue
authorBenjamin Otte <otte@redhat.com>
Mon, 16 Jul 2012 12:15:19 +0000 (14:15 +0200)
committerBenjamin Otte <otte@redhat.com>
Tue, 28 Aug 2012 13:40:57 +0000 (15:40 +0200)
This way, we don't need the print_value vfunc anymore.

gtk/gtkcsscustomproperty.c
gtk/gtkcsstypedvalue.c

index f017f7c0887fec2dc994ac90a3afb0b4c0f3a425..6c8960e52ce016c06feb3be25241d57b703cd68f 100644 (file)
@@ -122,22 +122,9 @@ _gtk_css_custom_property_class_init (GtkCssCustomPropertyClass *klass)
   property_class->assign = gtk_css_custom_property_assign;
 }
 
-static GtkCssValue *
-gtk_css_custom_property_compute_value (GtkCssStyleProperty *property,
-                                       GtkStyleContext     *context,
-                                       GtkCssValue         *specified)
-{
-  GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (property);
-
-  return _gtk_css_style_compute_value (context, custom->pspec->value_type, specified);
-}
-
 static void
 _gtk_css_custom_property_init (GtkCssCustomProperty *custom)
 {
-  GtkCssStyleProperty *style = GTK_CSS_STYLE_PROPERTY (custom);
-
-  style->compute_value = gtk_css_custom_property_compute_value;
 }
 
 static GtkCssValue *
index eb98684d4071bf9730fcb123a6afdf505507ee76..60eeea8c6869a83a842cedc299eb767ca5670a02 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "gtkcsstypedvalueprivate.h"
 
+#include "gtkcsscustompropertyprivate.h"
 #include "gtkcssstylefuncsprivate.h"
 
 struct _GtkCssValue {
@@ -38,7 +39,9 @@ gtk_css_value_typed_compute (GtkCssValue     *value,
                              guint            property_id,
                              GtkStyleContext *context)
 {
-  return _gtk_css_value_ref (value);
+  GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (_gtk_css_style_property_lookup_by_id (property_id));
+
+  return _gtk_css_style_compute_value (context, custom->pspec->value_type, value);
 }
 
 static gboolean